package com.example.kaogong.sys.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.kaogong.sys.pojo.Question;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.kaogong.sys.pojo.vo.QuestionVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 题目 Mapper 接口
 * </p>
 *
 * @author    
 * @since 2022-03-26
 */
@Mapper
public interface QuestionMapper extends BaseMapper<Question> {

    /**
     * 根据试题编号删除试题
     * @param questionId
     * @return
     */
    @Update({"update t_question set deleted = 1 where question_id = #{questionId}"})
    int deleteQuestionByQuestionId(Integer questionId);

    /**
     * 分页查询老师试题
     * @param questionVoPage
     * @param teacherId
     * @return
     */
    Page<QuestionVo> getAllQuestionByTeacherId(@Param("page") Page<QuestionVo> questionVoPage, @Param("tid") Integer teacherId);

    /**
     * getAllQuestionByType
     * @param type
     * @return
     */
    List<QuestionVo> getAllQuestionByType(Integer type);
}
